// JavaScript Document
<!--
function Slider(container, frequency, direction) {
  if (typeof(container) == 'string') {
    container = document.getElementById(container);
  }
  this.container = container;
  this.frequency = frequency;
  this.direction = direction;
  this.films = [];
  this._playTimeoutId = null;
  this._slideTimeoutId = null;
  this._slidable = true;
	this._current = 0;

  var divs = this.container.getElementsByTagName('li');
  for (var i = 0; i < divs.length; i++) {
      divs[i].onmouseover = function(self){return function(){self._mouseover()};}(this);
      divs[i].onmouseout = function(self){return function(){self._mouseout()};}(this);
  }
  this._loop();
}

Slider.prototype = {
  _loop : function() {
    var sb = this;
    this._playTimeoutId = setTimeout(function(){sb._slide()}, this.frequency);
  },

  _slide : function() {
    var sb = this;
		//$('test').innerHTML+=sb.container.id+'='+sb._slidable+'<br/>';
		if(sb._slidable){
			var c = sb.container;
			Effect.Fade(c.getElementsByTagName('li')[this._current],{duration:1,from:0.8,to:0});
			this._current++;
			if(this._current>=c.getElementsByTagName('li').length){
					this._current=0
			}
			Effect.Appear(c.getElementsByTagName('li')[this._current]);
		}
    this._playTimeoutId = setTimeout(function(){sb._slide()}, this.frequency);
  },

  _mouseover : function() {
    this._slidable = false;
  },

  _mouseout : function() {
    this._slidable = true;
  }
}